import { paddingleft, paddingRight } from '../../../utils/index'
export const headerData = [{
  value: 'compressibilityRatio',
  label: '压缩系数比',
  en: 'Zz',
  index: 0
}, {
  value: 'correctionCoefficient',
  label: '修正系数比',
  en: 'C',
  index: 1
}, {
  value: 'kcoefficient',
  label: 'K系数',
  en: 'K',
  index: 2
}, {
  value: 'errorTemperature',
  label: '温度测量错误时代替值',
  en: 'DefaultTemperature',
  index: 3,
  hide: 'hide'
}, {
  value: 'errorAirPressure',
  label: '气压测量错误时代替值',
  en: 'DefaultPressure',
  index: 4,
  hide: 'hide'
}, {
  value: 'normCumulant',
  label: '标况累积量',
  width: 120,
  en: 'Vb',
  unit: 'm3',
  index: 5
}, {
  value: 'workCumulant',
  label: '工况累积量',
  width: 120,
  en: 'V',
  unit: 'm3',
  index: 6
}, {
  value: 'errorNormCumulant',
  label: '错误标况累积量',
  width: 120,
  unit: 'm3',
  en: 'eVs',
  index: 7
}, {
  value: 'errorWorkCumulant',
  label: '错误工况累积量',
  width: 120,
  unit: 'm3',
  en: 'eV',
  index: 8
}, {
  value: 'workPressure',
  label: '工况压力',
  unit: 'Kpa',
  en: 'Pa',
  index: 9
}, {
  value: 'workTemperature',
  label: '工况温度',
  unit: '℃',
  en: 'Ta',
  index: 10
}, {
  value: 'workMomentFlow',
  label: '工况瞬时流量',
  unit: 'm3h',
  width: 120,
  en: 'Q',
  index: 11
}, {
  value: 'normMomentFlow',
  label: '标况瞬时流量',
  unit: 'm3h',
  en: 'Qb',
  width: 120,
  index: 12
}, {
  value: 'batteryLevel',
  en: 'Batt.cap',
  label: '电池电量（%）',
  index: 13
}, {
  value: 'meterKCoefficient',
  en: 'Kp',
  label: '仪表K系数',
  index: 14
}
]

export const deviceKeyVal = {
  compressibilityRatio: '压缩系数比',
  correctionCoefficient: '修正系数比',
  meterKCoefficient: '仪表K系数',
  errorTemperature: '温度测量错误时代替值',
  errorAirPressure: '气压测量错误时代替值',
  normCumulant: '标况累积量',
  workCumulant: '工况累积量',
  errorNormCumulant: '错误标况累积量',
  errorWorkCumulant: '错误工况累积量',
  workPressure: '工况压力',
  workTemperature: '工况温度',
  workMomentFlow: '工况瞬时流量',
  normMomentFlow: '标况瞬时流量',
  batteryLevel: '电池电量'
}
export const deviceKeyEnVal = {
  Zz: '压缩系数比',
  C: '修正系数比',
  K: ' K系数',
  Kp: '仪表K系数',
  DefaultTemperature: '温度测量错误时代替值',
  DefaultPressure: '气压测量错误时代替值',
  Vb: '标况累积量',
  V: '工况累积量',
  eVs: '错误标况累积量',
  eV: '错误工况累积量',
  en: '工况压力',
  Ta: '工况温度',
  Q: '工况瞬时流量',
  Qb: '标况瞬时流量',
  batteryLevel: '电池电量'
}
export const units = {
  // Zz: '压缩系数比',
  // C: '修正系数比',
  // K: ' K系数',
  Kp: 'm3/imp',
  // DefaultTemperature: '温度测量错误时代替值',
  // DefaultPressure: '气压测量错误时代替值',
  Vb: 'm3',
  V: 'm3',
  eVs: 'm3',
  eV: 'm3',
  en: 'Kpa',
  Ta: '℃',
  Q: 'm3/h',
  Qb: 'm3/h',
  'Batt.cap': '%'
}
export const oneScanShowdatas = {
  normCumulant: 'Vb',
  workCumulant: 'v ',
  workPressure: 'Pa',
  workTemperature: 'Ta',
  batteryLevel: 'Batt.cap'
}
export const oneScanShowUnits = {
  normCumulant: 'm3',
  workCumulant: 'm3',
  workPressure: 'Kpa',
  workTemperature: '℃',
  batteryLevel: '%'
}
export const zero = {
  normCumulant: { // 标况累积量
    left: 11,
    right: 2,
    total: 14
  },
  workCumulant: {// '工况累积量',
    left: 11,
    right: 2,
    total: 14
  },
  errorAirPressure: {
    right: 2
  },
  errorNormCumulant: { // 错误标况累积量
    left: 11,
    right: 2,
    total: 14
  },
  errorWorkCumulant: { // 错误工况累积量
    left: 11,
    right: 2,
    total: 14
  },
  workPressure: { // 工况压力
    right: 2
  },
  workTemperature: { // '工况温度'
    right: 2
  },
  workMomentFlow: { // 工况瞬时流量
    right: 2
  },
  normMomentFlow: { // 标况瞬时流量
    right: 2
  },
  // batteryLevel: { // 电池电量
  //   right: 2
  // },
  compressibilityRatio: { // 压缩系数比
    right: 6
  },
  correctionCoefficient: { // 修正系数比
    right: 6
  },
  kcoefficient: { // K系数
    right: 6
  },
  meterKCoefficient: { // 仪表K系数
    right: 3
  }
}
export const hisData = ['normCumulant', 'workCumulant', 'errorNormCumulant', 'errorWorkCumulant', 'workTemperature', 'workPressure',
  'workMomentFlow', 'normMomentFlow', 'kcoefficient', 'correctionCoefficient', 'compressibilityRatio', 'batteryLevel', 'meterKCoefficient']
export const hisData1 = [headerData[5], headerData[6], headerData[7], headerData[8], headerData[10], headerData[9],
  headerData[11], headerData[12], headerData[2], headerData[1], headerData[0], headerData[13], headerData[14]]

export function zeroVals(key, val) {
  let res = val
  if (key && zero[key]) {
    const obj = zero[key]
    if (obj.right) {
      res = paddingRight(res, obj.right)
    }
    if (obj.left) {
      res = paddingleft(res, obj.left + (obj.right || 0))
    }
  }
  if (!res) {
    console.log(key)
  }
  return res
}
